//
//  ViewController.m
//  01-链式编程思想
//
//  Created by J on 16/2/18.
//  Copyright © 2016年 J. All rights reserved.
//

#import "ViewController.h"
#import "Masonry.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    void(^block)(MASConstraintMaker*maker) = ^(MASConstraintMaker* make){
        //make.left.top:把左边和顶部的约束全部保存到 MASConstraintMaker的constraints数组里 newConstraint.delegate = MASConstraintMaker;
        //.equalTo:方法
    id(^block)(id attribute) =  ^id(id attribute) {
//            return self.equalToWithRelation(attribute, NSLayoutRelationEqual);
                return  nil;
    };
        make.left.top.equalTo(@10);//左和上
        make.right.bottom.equalTo(@(-10));//右和下
//        NSLog(@"%@",make.left);//MASViewConstraint
        
    };
    
//    block(@10);
    UIView* redView = [UIView new];
    redView.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:redView];
//    [redView mas_makeConstraints:^(MASConstraintMaker *make) {
//        //描述控件的约束
//        //上下左右间距都为10
//        make.left.top.equalTo(@10);//左和上
//        make.right.bottom.equalTo(@(-10));//右和下
//        
//    }];
    [redView mas_makeConstraints:block];

    //mas_makeConstraints 给控件设置布局 参数:block
    //- (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *))block {
    //1.创建一个约束制造者
    //2.调用block(maker)
    //3.[constraintMaker install]
    

    
    
}



@end
